package com.qf.entitys;

import java.io.Serializable;

public class RespBean implements Serializable {
    //返回的响应码
    private Integer code;
    //返回的提示信息
    private String message;
    //返回的数据
    private Object data;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    private RespBean(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    /*  编写三个静态的业务执行成功的方法 */
    public static RespBean success(String message){
        return new RespBean(200,message,null);
    }
    public static RespBean success(Object data){
        return new RespBean(200,null,data);
    }

    public static RespBean success(Integer code,String message){
        return new RespBean(code,message,null);
    }

    public static RespBean success(Integer code,String message,Object data){
        return new RespBean(code,message,data);
    }

    /*  编写三个静态的业务执行失败的方法 */
    public static RespBean error(String message){
        return new RespBean(500,message,null);
    }

    public static RespBean error(Integer code,String message){
        return new RespBean(code,message,null);
    }

    public static RespBean error(Integer code,String message,Object data){
        return new RespBean(code,message,data);
    }

}
